(function(window){
    var s = {};
    s.alertBox = function(info) {
        if(!info) {
            info = {
                "family_relation": "",
                "family_nation": "",
                "family_name":"",
                "family_fzzmm":"",
                "family_work":"",
                "family_workAddr":"",
                "family_phone":""
            }
        }
        // 获取页面高度
        var sHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
        var sWidth = document.documentElement.scrollWidth || document.body.body.scrollWidth;
        //可视区域的高度
        var wHeight = document.documentElement.clientHeight || document.body.clientHeight;

        //  创建节点
        var block = document.createElement("div");
        block.id = "block";
        block.style.height = sHeight + "px";
        block.style.width = sWidth + "px";
        document.body.appendChild(block);
        var newalert = document.createElement("div");
        newalert.id = "newalert"; 
        newalert.innerHTML = "<div class='title'>编辑家庭人员信息</div><div class='newitem'><div class='newitem_text'>家庭关系</div><input id='relation' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_relation + "' ></div><div class='newitem'><div class='newitem_text'>姓名</div><input id='name' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_name + "' ></div><div class='newitem'><div class='newitem_text'>族别</div><input id='nation' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' readonly value='" + info.family_nation + "'></div> <div class='newitem'><div class='newitem_text'>政治面貌</div><input id='fzzmm' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_fzzmm + "'></div> <div class='newitem'><div class='newitem_text'>从事工作</div><input id='work' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_work + "'></div><div class='newitem'><div class='newitem_text'>工作单位</div><input id='workAddr' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_workAddr + "' ></div><div class='newitem'><div class='newitem_text'>联系方式</div><input id='phone' type='text' style=' position: absolute;left:85px;height: 40px;line-height: 40px;width: 215px;font-size: 14px' value='" + info.family_phone + "'></div><div class='submit'><button id='tijiao' class='btn' style='color:white'>提交</button></div>"
        document.body.appendChild(newalert);
        //获取newalert的高度和宽度
        var dHeight = newalert.offsetHeight;
        var dWidth = newalert.offsetWidth;
        newalert.style.left = (sWidth - dWidth) / 2 + "px";
        newalert.style.top = (wHeight - dHeight) / 2 + "px";

        //点击遮罩层以外消失
        block.onclick = function () {
            document.body.removeChild(block);
            document.body.removeChild(newalert)
        }
    }
    window.UIKit = s;
})(window)